﻿using System;
using System.Collections.Generic;
using System.Text;

namespace IceDog.DNL.CSharp.DesignPattern.InterpreterPattern.PersonExpression
{
    public class TerminalExpression:IExpression
    {
        private readonly string _data;

        /// <summary>Initializes a new instance of the <see cref="T:IceDog.DNL.CSharp.DesignPattern.InterpreterPattern.PersonExpression.TerminalExpression"></see> class.</summary>
        public TerminalExpression(string data)
        {
            _data = data;
        }

        /// <summary>
        /// 解释
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public bool Interpret(string context)
        {
            return context.Contains(_data);
        }
    }
}
